/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.yonsei.iwb.smarttv.util;

import java.io.File;
import java.text.NumberFormat;
import java.util.Vector;

/**
 *
 * @author JDK
 */
public class UtilMethodSet {
    
    public static Vector<String> getFileList(String filename) {
        File file = new File(filename);
        Vector<String> list = new Vector<String>();
        if (file.isDirectory()) {
            String[] filelist = file.list();
            for (int j = 0; j < filelist.length; j++) {                               
                list.add(filelist[j]);
            }            
        }
        return list;
    }
        
    public static String getStringForIndex(Vector<String> v) {
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < v.size(); i++) {
            sb.append(v.get(i) + " ");
        }
        return sb.toString().trim();
    }
    
    public static String getConjunctionStringForIndex(Vector<String> v) {
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < v.size(); i++) {
            sb.append("+"+v.get(i) + " ");
        }
        return sb.toString().trim();
    }
    
    public static String getVariableCharacter(int num){        
        String variableName = "x"+num;        
        return variableName;
    }
    
    public static String longDouble2String(int size, double value) {
        NumberFormat nf = NumberFormat.getNumberInstance();
        nf.setMaximumFractionDigits(size);
        nf.setGroupingUsed(false);
        return nf.format(value);
    }
}
